<?php
/**
 * 物料
 * Created by PhpStorm.
 * User: echa
 * Date: 2018/1/23
 * Time: 14:49
 *
 *
 */

namespace App\Services\Warehouse;


class MaterialService extends  PublicService {

    //物料表单ID
    //protected  $Formid='BD_MATERIAL';

    public function __construct()
    {
        parent::__construct(Config('k3cloud.Material'));
    }


    /**
     *查看---已废弃
     *1.formid：业务对象表单Id（必录）
    2.data：Json格式数据（详情参考Json格式数据）（必录）
        2.1.CreateOrgId：创建者组织，字符串类型（非必录）
        2.2.Number：单据编号，字符串类型（用编号查询必录）
        2.3.Id：表的主键Id（用Id查询时必录）
     *
    */
    public  function ViewMaterial($Number='',$Id=''){
        return $this->view($Number,$Id);
    }


    /**
       保存
     * 1.formid：业务对象表单Id（必录）
    2.data：Json格式数据（详情参考Json格式数据）（必录）
        2.1.Creator：创建者名字（非必录）
        2.2.NeedUpDateFields：需要保存的字段,格式["fieldkey1","fieldkey2","entitykey1",...]，数组类型(非必录)
        2.3.NeedReturnFields：需要返回的结果字段,格式["fieldkey","entitykey.fieldkey",...]（非必录）
        2.4.IsDeleteEntry：是否删除分录，默认True删除（非必录）
        2.5.SubSystemId：菜单所在子系统Id（非必录）
        2.6.IsVerifyBaseDataField：是否验证所有的基础资料，默认False不验证（非必录）
        2.7.IsEntryBatchFill：是否批量填充分录：默认为Ture（非必录）
        2.8.Model：表单实体数据（必录）
     */
    public function SaveMaterial($arrdata=[]){
            $data=[
                    "FMATERIALID"=>"0",
                    "FCreateOrgId"=>[
                        "FNumber"=>"100"
                    ],
                    "FUseOrgId"=>[
                        "FNumber"=>"100"
                    ],
                    "FNumber"=>"",
                    "FName"=>"测试商品",
                    "FSpecification"=>"",
                    "FMnemonicCode"=>"",
                    "FOldNumber"=>"",
                    "FDescription"=>"",
                    "FMaterialGroup"=>[
                        "FNumber"=>""
                    ],
                    "FImgStorageType"=>"B",
                    "FIsSalseByNet"=>false,
                    "SubHeadEntity"=>[
                        "FBARCODE"=>"",
                        "FErpClsID"=>"1",
                        "FCONFIGTYPE"=>"",
                        "FCategoryID"=>[
                            "FNumber"=>"CHLB01_SYS"
                        ],
                        "FTaxType"=>[
                            "FNumber"=>"WLDSFL01_SYS"
                        ],
                        "FTaxRateId"=>[
                            "FNumber"=>"SL01_SYS"
                        ],
                        "FBaseUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FIsPurchase"=>true,
                        "FIsInventory"=>true,
                        "FIsSubContract"=>false,
                        "FIsSale"=>true,
                        "FIsProduce"=>false,
                        "FIsAsset"=>false,
                        "FGROSSWEIGHT"=>0.0,
                        "FNETWEIGHT"=>0.0,
                        "FWEIGHTUNITID"=>[
                            "FNumber"=>"kg"
                        ],
                        "FLENGTH"=>0.0,
                        "FWIDTH"=>0.0,
                        "FHEIGHT"=>0.0,
                        "FVOLUME"=>0.0,
                        "FVOLUMEUNITID"=>[
                            "FNumber"=>"m"
                        ],
                        "FSuite"=>"0"
                    ],
                    "SubHeadEntity1"=>[
                        "FStoreUnitID"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FAuxUnitID"=>[
                            "FNumber"=>""
                        ],
                        "FUnitConvertDir"=>"1",
                        "FStockId"=>[
                            "FNumber"=>""
                        ],
                        "FStockPlaceId"=>[
                            "FSTOCKPLACEID__FF100001"=>[
                                "FNUMBER"=>""
                            ]
                        ],
                        "FIsLockStock"=>true,
                        "FIsCycleCounting"=>false,
                        "FCountCycle"=>"1",
                        "FCountDay"=>1,
                        "FIsMustCounting"=>false,
                        "FIsBatchManage"=>false,
                        "FBatchRuleID"=>[
                            "FNumber"=>""
                        ],
                        "FIsKFPeriod"=>false,
                        "FIsExpParToFlot"=>false,
                        "FExpUnit"=>"",
                        "FExpPeriod"=>0,
                        "FOnlineLife"=>0,
                        "FRefCost"=>0.0,
                        "FCurrencyId"=>[
                            "FNumber"=>"PRE001"
                        ],
                        "FIsEnableMinStock"=>false,
                        "FIsEnableMaxStock"=>false,
                        "FIsEnableSafeStock"=>false,
                        "FIsEnableReOrder"=>false,
                        "FMinStock"=>0.0,
                        "FSafeStock"=>0.0,
                        "FReOrderGood"=>0.0,
                        "FEconReOrderQty"=>0.0,
                        "FMaxStock"=>0.0,
                        "FIsSNManage"=>false,
                        "FIsSNPRDTracy"=>false,
                        "FSNCodeRule"=>[
                            "FNumber"=>""
                        ],
                        "FSNUnit"=>[
                            "FNumber"=>""
                        ],
                        "FSNManageType"=>"1",
                        "FSNGenerateTime"=>"1",
                        "FBoxStandardQty"=>0.0
                    ],
                    "SubHeadEntity2"=>[
                        "FSaleUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSalePriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FOrderQty"=>0.0,
                        "FMinQty"=>0.0,
                        "FMaxQty"=>100000.0,
                        "FOutStockLmtH"=>0.0,
                        "FOutStockLmtL"=>0.0,
                        "FAgentSalReduceRate"=>0.0,
                        "FIsATPCheck"=>false,
                        "FIsReturnPart"=>false,
                        "FIsInvoice"=>false,
                        "FIsReturn"=>true,
                        "FAllowPublish"=>false,
                        "FISAFTERSALE"=>true,
                        "FISPRODUCTFILES"=>true,
                        "FISWARRANTED"=>false,
                        "FWARRANTY"=>0,
                        "FWARRANTYUNITID"=>"D",
                        "FOutLmtUnit"=>"SAL",
                        "FTaxCategoryCodeId"=>[
                            "FNumber"=>""
                        ],
                        "FSalGroup"=>[
                            "FNumber"=>""
                        ],
                        "FIsTaxEnjoy"=>false,
                        "FTaxDiscountsType"=>"0"
                    ],
                    "SubHeadEntity3"=>[
                        "FBaseMinSplitQty"=>0.0,
                        "FPurchaseUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FPurchasePriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FPurchaseOrgId"=>[
                            "FNumber"=>"100"
                        ],
                        "FPurchaseGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FPurchaserId"=>[
                            "FNumber"=>""
                        ],
                        "FDefaultVendor"=>[
                            "FNumber"=>""
                        ],
                        "FChargeID"=>[
                            "FNumber"=>""
                        ],
                        "FIsQuota"=>false,
                        "FQuotaType"=>"1",
                        "FMinSplitQty"=>0.0,
                        "FIsVmiBusiness"=>false,
                        "FEnableSL"=>false,
                        "FIsPR"=>false,
                        "FIsReturnMaterial"=>true,
                        "FIsSourceControl"=>false,
                        "FReceiveMaxScale"=>0.0,
                        "FReceiveMinScale"=>0.0,
                        "FReceiveAdvanceDays"=>0,
                        "FReceiveDelayDays"=>0,
                        "FAgentPurPlusRate"=>0.0,
                        "FDefBarCodeRuleId"=>[
                            "FNumber"=>""
                        ],
                        "FPrintCount"=>1,
                        "FMinPackCount"=>1
                    ],
                    "SubHeadEntity4"=>[
                        "FPlanMode"=>"0",
                        "FBaseVarLeadTimeLotSize"=>0.0,
                        "FPlanningStrategy"=>"1",
                        "FMfgPolicyId"=>[
                            "FNumber"=>"ZZCL001_SYS"
                        ],
                        "FOrderPolicy"=>"0",
                        "FPlanWorkshop"=>[
                            "FNumber"=>""
                        ],
                        "FFixLeadTime"=>0,
                        "FFixLeadTimeType"=>"1",
                        "FVarLeadTime"=>0,
                        "FVarLeadTimeType"=>"1",
                        "FCheckLeadTime"=>0,
                        "FCheckLeadTimeType"=>"1",
                        "FOrderIntervalTimeType"=>"3",
                        "FOrderIntervalTime"=>0,
                        "FMaxPOQty"=>100000.0,
                        "FMinPOQty"=>0.0,
                        "FIncreaseQty"=>0.0,
                        "FEOQ"=>1.0,
                        "FVarLeadTimeLotSize"=>1.0,
                        "FPlanIntervalsDays"=>0,
                        "FPlanBatchSplitQty"=>0.0,
                        "FRequestTimeZone"=>0,
                        "FPlanTimeZone"=>0,
                        "FPlanGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FPlanerID"=>[
                            "FNumber"=>""
                        ],
                        "FCanLeadDays"=>0,
                        "FIsMrpComReq"=>false,
                        "FLeadExtendDay"=>0,
                        "FReserveType"=>"1",
                        "FPlanSafeStockQty"=>0.0,
                        "FAllowPartAhead"=>false,
                        "FCanDelayDays"=>999,
                        "FDelayExtendDay"=>0,
                        "FAllowPartDelay"=>true,
                        "FPlanOffsetTimeType"=>"1",
                        "FPlanOffsetTime"=>0,
                        "FSupplySourceId"=>[
                            "FNumber"=>""
                        ],
                        "FTimeFactorId"=>[
                            "FNumber"=>""
                        ],
                        "FQtyFactorId"=>[
                            "FNumber"=>""
                        ]
                    ],
                    "SubHeadEntity5"=>[
                        "FWorkShopId"=>[
                            "FNumber"=>""
                        ],
                        "FProduceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FFinishReceiptOverRate"=>0.0,
                        "FFinishReceiptShortRate"=>0.0,
                        "FProduceBillType"=>[
                            "FNumber"=>"SCDD03_SYS"
                        ],
                        "FOrgTrustBillType"=>[
                            "FNumber"=>"SCDD06_SYS"
                        ],
                        "FIsSNCarryToParent"=>false,
                        "FIsProductLine"=>false,
                        "FBOMUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FLOSSPERCENT"=>0.0,
                        "FConsumVolatility"=>0.0,
                        "FIsMainPrd"=>false,
                        "FIsCoby"=>false,
                        "FIsECN"=>false,
                        "FIssueType"=>"1",
                        "FBKFLTime"=>"",
                        "FPickStockId"=>[
                            "FNumber"=>""
                        ],
                        "FPickBinId"=>[
                            "FPICKBINID__FF100001"=>[
                                "FNUMBER"=>""
                            ]
                        ],
                        "FOverControlMode"=>"1",
                        "FMinIssueQty"=>1.0,
                        "FISMinIssueQty"=>false,
                        "FIsKitting"=>false,
                        "FIsCompleteSet"=>false,
                        "FDefaultRouting"=>[
                            "FNumber"=>""
                        ],
                        "FStdLaborPrePareTime"=>0.0,
                        "FStdLaborProcessTime"=>0.0,
                        "FStdMachinePrepareTime"=>0.0,
                        "FStdMachineProcessTime"=>0.0,
                        "FMinIssueUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FMdlId"=>[
                            "FNumber"=>""
                        ],
                        "FMdlMaterialId"=>[
                            "FNumber"=>""
                        ]
                    ],
                    "SubHeadEntity7"=>[
                        "FSubconUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSubconPriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSubBillType"=>[
                            "FNumber"=>"WWDD01_SYS"
                        ]
                    ],
                    "SubHeadEntity6"=>[
                        "FCheckIncoming"=>false,
                        "FCheckProduct"=>false,
                        "FCheckStock"=>false,
                        "FCheckReturn"=>false,
                        "FCheckDelivery"=>false,
                        "FEnableCyclistQCSTK"=>false,
                        "FStockCycle"=>0,
                        "FEnableCyclistQCSTKEW"=>false,
                        "FEWLeadDay"=>0,
                        "FIncSampSchemeId"=>[
                            "FNumber"=>""
                        ],
                        "FIncQcSchemeId"=>[
                            "FNumber"=>""
                        ],
                        "FInspectGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FInspectorId"=>[
                            "FNumber"=>""
                        ],
                        "FCheckEntrusted"=>false,
                        "FCheckOther"=>false
                    ],
                    "FEntityInvPty"=>[
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"01"
                            ],
                            "FIsEnable"=>true,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"02"
                            ],
                            "FIsEnable"=>true,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"03"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"04"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"06"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ]
                    ]
                ];
           return $this->save($data);
   }


    /**
    批量保存
     * 1.formid：业务对象表单Id（必录）
    2.data：Json格式数据（详情参考Json格式数据）（必录）
        2.1.NumberSearch：是否使用Number来搜索基础资料，默认为True（非必录）
        2.2.ValidateFlag：是否验证标志，布尔类型,默认为True（非必录）
        2.3.IsDeleteEntry：是否删除分录，默认True删除（非必录）
        2.4.NeedUpDateFields：需要保存的字段,格式["fieldkey1","fieldkey2","entitykey1",...]，数组类型(非必录)
        2.5.NeedReturnFields：需要返回的结果字段,格式["fieldkey","entitykey.fieldkey",...]（非必录）
        2.6.SubSystemId：菜单所在子系统Id（非必录）
        2.7.Model：表单实体数据（必录）
        2.8.BatchCount：批量保存线程数，整形（非必录）

     */
    public function BatchsaveMaterial($arrdata=[]){
            $data=[
                    "FMATERIALID"=>"0",
                    "FCreateOrgId"=>[
                        "FNumber"=>"100"
                    ],
                    "FUseOrgId"=>[
                        "FNumber"=>"100"
                    ],
                    "FNumber"=>"",
                    "FName"=>"测试商品",
                    "FSpecification"=>"",
                    "FMnemonicCode"=>"",
                    "FOldNumber"=>"",
                    "FDescription"=>"",
                    "FMaterialGroup"=>[
                        "FNumber"=>""
                    ],
                    "FImgStorageType"=>"B",
                    "FIsSalseByNet"=>false,
                    "SubHeadEntity"=>[
                        "FBARCODE"=>"",
                        "FErpClsID"=>"1",
                        "FCONFIGTYPE"=>"",
                        "FCategoryID"=>[
                            "FNumber"=>"CHLB01_SYS"
                        ],
                        "FTaxType"=>[
                            "FNumber"=>"WLDSFL01_SYS"
                        ],
                        "FTaxRateId"=>[
                            "FNumber"=>"SL01_SYS"
                        ],
                        "FBaseUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FIsPurchase"=>true,
                        "FIsInventory"=>true,
                        "FIsSubContract"=>false,
                        "FIsSale"=>true,
                        "FIsProduce"=>false,
                        "FIsAsset"=>false,
                        "FGROSSWEIGHT"=>0.0,
                        "FNETWEIGHT"=>0.0,
                        "FWEIGHTUNITID"=>[
                            "FNumber"=>"kg"
                        ],
                        "FLENGTH"=>0.0,
                        "FWIDTH"=>0.0,
                        "FHEIGHT"=>0.0,
                        "FVOLUME"=>0.0,
                        "FVOLUMEUNITID"=>[
                            "FNumber"=>"m"
                        ],
                        "FSuite"=>"0"
                    ],
                    "SubHeadEntity1"=>[
                        "FStoreUnitID"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FAuxUnitID"=>[
                            "FNumber"=>""
                        ],
                        "FUnitConvertDir"=>"1",
                        "FStockId"=>[
                            "FNumber"=>""
                        ],
                        "FStockPlaceId"=>[
                            "FSTOCKPLACEID__FF100001"=>[
                                "FNUMBER"=>""
                            ]
                        ],
                        "FIsLockStock"=>true,
                        "FIsCycleCounting"=>false,
                        "FCountCycle"=>"1",
                        "FCountDay"=>1,
                        "FIsMustCounting"=>false,
                        "FIsBatchManage"=>false,
                        "FBatchRuleID"=>[
                            "FNumber"=>""
                        ],
                        "FIsKFPeriod"=>false,
                        "FIsExpParToFlot"=>false,
                        "FExpUnit"=>"",
                        "FExpPeriod"=>0,
                        "FOnlineLife"=>0,
                        "FRefCost"=>0.0,
                        "FCurrencyId"=>[
                            "FNumber"=>"PRE001"
                        ],
                        "FIsEnableMinStock"=>false,
                        "FIsEnableMaxStock"=>false,
                        "FIsEnableSafeStock"=>false,
                        "FIsEnableReOrder"=>false,
                        "FMinStock"=>0.0,
                        "FSafeStock"=>0.0,
                        "FReOrderGood"=>0.0,
                        "FEconReOrderQty"=>0.0,
                        "FMaxStock"=>0.0,
                        "FIsSNManage"=>false,
                        "FIsSNPRDTracy"=>false,
                        "FSNCodeRule"=>[
                            "FNumber"=>""
                        ],
                        "FSNUnit"=>[
                            "FNumber"=>""
                        ],
                        "FSNManageType"=>"1",
                        "FSNGenerateTime"=>"1",
                        "FBoxStandardQty"=>0.0
                    ],
                    "SubHeadEntity2"=>[
                        "FSaleUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSalePriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FOrderQty"=>0.0,
                        "FMinQty"=>0.0,
                        "FMaxQty"=>100000.0,
                        "FOutStockLmtH"=>0.0,
                        "FOutStockLmtL"=>0.0,
                        "FAgentSalReduceRate"=>0.0,
                        "FIsATPCheck"=>false,
                        "FIsReturnPart"=>false,
                        "FIsInvoice"=>false,
                        "FIsReturn"=>true,
                        "FAllowPublish"=>false,
                        "FISAFTERSALE"=>true,
                        "FISPRODUCTFILES"=>true,
                        "FISWARRANTED"=>false,
                        "FWARRANTY"=>0,
                        "FWARRANTYUNITID"=>"D",
                        "FOutLmtUnit"=>"SAL",
                        "FTaxCategoryCodeId"=>[
                            "FNumber"=>""
                        ],
                        "FSalGroup"=>[
                            "FNumber"=>""
                        ],
                        "FIsTaxEnjoy"=>false,
                        "FTaxDiscountsType"=>"0"
                    ],
                    "SubHeadEntity3"=>[
                        "FBaseMinSplitQty"=>0.0,
                        "FPurchaseUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FPurchasePriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FPurchaseOrgId"=>[
                            "FNumber"=>"100"
                        ],
                        "FPurchaseGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FPurchaserId"=>[
                            "FNumber"=>""
                        ],
                        "FDefaultVendor"=>[
                            "FNumber"=>""
                        ],
                        "FChargeID"=>[
                            "FNumber"=>""
                        ],
                        "FIsQuota"=>false,
                        "FQuotaType"=>"1",
                        "FMinSplitQty"=>0.0,
                        "FIsVmiBusiness"=>false,
                        "FEnableSL"=>false,
                        "FIsPR"=>false,
                        "FIsReturnMaterial"=>true,
                        "FIsSourceControl"=>false,
                        "FReceiveMaxScale"=>0.0,
                        "FReceiveMinScale"=>0.0,
                        "FReceiveAdvanceDays"=>0,
                        "FReceiveDelayDays"=>0,
                        "FAgentPurPlusRate"=>0.0,
                        "FDefBarCodeRuleId"=>[
                            "FNumber"=>""
                        ],
                        "FPrintCount"=>1,
                        "FMinPackCount"=>1
                    ],
                    "SubHeadEntity4"=>[
                        "FPlanMode"=>"0",
                        "FBaseVarLeadTimeLotSize"=>0.0,
                        "FPlanningStrategy"=>"1",
                        "FMfgPolicyId"=>[
                            "FNumber"=>"ZZCL001_SYS"
                        ],
                        "FOrderPolicy"=>"0",
                        "FPlanWorkshop"=>[
                            "FNumber"=>""
                        ],
                        "FFixLeadTime"=>0,
                        "FFixLeadTimeType"=>"1",
                        "FVarLeadTime"=>0,
                        "FVarLeadTimeType"=>"1",
                        "FCheckLeadTime"=>0,
                        "FCheckLeadTimeType"=>"1",
                        "FOrderIntervalTimeType"=>"3",
                        "FOrderIntervalTime"=>0,
                        "FMaxPOQty"=>100000.0,
                        "FMinPOQty"=>0.0,
                        "FIncreaseQty"=>0.0,
                        "FEOQ"=>1.0,
                        "FVarLeadTimeLotSize"=>1.0,
                        "FPlanIntervalsDays"=>0,
                        "FPlanBatchSplitQty"=>0.0,
                        "FRequestTimeZone"=>0,
                        "FPlanTimeZone"=>0,
                        "FPlanGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FPlanerID"=>[
                            "FNumber"=>""
                        ],
                        "FCanLeadDays"=>0,
                        "FIsMrpComReq"=>false,
                        "FLeadExtendDay"=>0,
                        "FReserveType"=>"1",
                        "FPlanSafeStockQty"=>0.0,
                        "FAllowPartAhead"=>false,
                        "FCanDelayDays"=>999,
                        "FDelayExtendDay"=>0,
                        "FAllowPartDelay"=>true,
                        "FPlanOffsetTimeType"=>"1",
                        "FPlanOffsetTime"=>0,
                        "FSupplySourceId"=>[
                            "FNumber"=>""
                        ],
                        "FTimeFactorId"=>[
                            "FNumber"=>""
                        ],
                        "FQtyFactorId"=>[
                            "FNumber"=>""
                        ]
                    ],
                    "SubHeadEntity5"=>[
                        "FWorkShopId"=>[
                            "FNumber"=>""
                        ],
                        "FProduceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FFinishReceiptOverRate"=>0.0,
                        "FFinishReceiptShortRate"=>0.0,
                        "FProduceBillType"=>[
                            "FNumber"=>"SCDD03_SYS"
                        ],
                        "FOrgTrustBillType"=>[
                            "FNumber"=>"SCDD06_SYS"
                        ],
                        "FIsSNCarryToParent"=>false,
                        "FIsProductLine"=>false,
                        "FBOMUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FLOSSPERCENT"=>0.0,
                        "FConsumVolatility"=>0.0,
                        "FIsMainPrd"=>false,
                        "FIsCoby"=>false,
                        "FIsECN"=>false,
                        "FIssueType"=>"1",
                        "FBKFLTime"=>"",
                        "FPickStockId"=>[
                            "FNumber"=>""
                        ],
                        "FPickBinId"=>[
                            "FPICKBINID__FF100001"=>[
                                "FNUMBER"=>""
                            ]
                        ],
                        "FOverControlMode"=>"1",
                        "FMinIssueQty"=>1.0,
                        "FISMinIssueQty"=>false,
                        "FIsKitting"=>false,
                        "FIsCompleteSet"=>false,
                        "FDefaultRouting"=>[
                            "FNumber"=>""
                        ],
                        "FStdLaborPrePareTime"=>0.0,
                        "FStdLaborProcessTime"=>0.0,
                        "FStdMachinePrepareTime"=>0.0,
                        "FStdMachineProcessTime"=>0.0,
                        "FMinIssueUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FMdlId"=>[
                            "FNumber"=>""
                        ],
                        "FMdlMaterialId"=>[
                            "FNumber"=>""
                        ]
                    ],
                    "SubHeadEntity7"=>[
                        "FSubconUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSubconPriceUnitId"=>[
                            "FNumber"=>"Pcs"
                        ],
                        "FSubBillType"=>[
                            "FNumber"=>"WWDD01_SYS"
                        ]
                    ],
                    "SubHeadEntity6"=>[
                        "FCheckIncoming"=>false,
                        "FCheckProduct"=>false,
                        "FCheckStock"=>false,
                        "FCheckReturn"=>false,
                        "FCheckDelivery"=>false,
                        "FEnableCyclistQCSTK"=>false,
                        "FStockCycle"=>0,
                        "FEnableCyclistQCSTKEW"=>false,
                        "FEWLeadDay"=>0,
                        "FIncSampSchemeId"=>[
                            "FNumber"=>""
                        ],
                        "FIncQcSchemeId"=>[
                            "FNumber"=>""
                        ],
                        "FInspectGroupId"=>[
                            "FNumber"=>""
                        ],
                        "FInspectorId"=>[
                            "FNumber"=>""
                        ],
                        "FCheckEntrusted"=>false,
                        "FCheckOther"=>false
                    ],
                    "FEntityInvPty"=>[
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"01"
                            ],
                            "FIsEnable"=>true,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"02"
                            ],
                            "FIsEnable"=>true,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"03"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"04"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ],
                        [
                            "FEntryID"=>null,
                            "FInvPtyId"=>[
                                "FNumber"=>"06"
                            ],
                            "FIsEnable"=>false,
                            "FIsAffectPrice"=>false,
                            "FIsAffectPlan"=>false,
                            "FIsAffectCost"=>false
                        ]
                    ]
                ];
            return $this->batchsave($data);
    }



    /**
       提交
     *1.formid：业务对象表单Id（必录）
    2.data：Json格式数据（详情参考Json格式数据）（必录）
        2.1.CreateOrgId：创建者组织，字符串类型（非必录）
        2.2.Numbers：单据编号集合，格式["billNo1","billNo1",...]，数组类型（必录）
     */
    public function  SubmitMaterial($Numbers=[]){
        return $this->submit($Numbers);
    }

    /**
        审核
     *
     * 1.formid：业务对象表单Id（必录）
    2.data：Json格式数据（详情参考Json格式数据）（必录）
        2.1.CreateOrgId：创建者组织，字符串类型（非必录）
        2.2.Numbers：单据编号集合，格式["billNo1","billNo1",...]，数组类型（必录）

     */
    public function AuditMaterial($Numbers=[]){
        return $this->audit($Numbers);
    }

    /**
     *单据列表查询
     * 1.data：Json格式数据（详情参考Json格式数据）（必录）
    1.1.FormId：业务对象表单Id（必录）
    1.2.FieldKeys：字段keys，字符串类型用逗号分隔，比如"key1,key2..."（必录）
    1.3.FilterString：过滤（非必录）  FNumber=''
    1.4.OrderString：排序字段（非必录）
    1.5.TopRowCount：总行数（非必录）
    1.6.StartRow：开始行（非必录）
    1.7.Limit：最大行数，不能超过2000（非必录）
     */
    public function ExecuteBillQueryMaterial($FieldKeys='',$FilterString='',$OrderString='',$TopRowCount=0,$StartRow=0,$Limit=20)
    {
            if (empty($FieldKeys)) {
                  $FieldKeys='FNumber,FName,FSpecification,FTaxRateId,FBARCODE,FMaterialGroup,FStoreUnitID,FDefaultVendor,FIsVmiBusiness,FBoxStandardQty,FGROSSWEIGHT,FWEIGHTUNITID,F_PAEZ_Assistant,F_PAEZ_Text,F_PAEZ_Combo,F_PAEZ_Combo1,F_PAEZ_Integer,F_PAEZ_Decimal,F_PAEZ_Integer';
            }
            return $this->ExecuteBillQuery($FieldKeys,$FilterString,$OrderString,$TopRowCount,$StartRow,$Limit);
    }

    /**
        获取物料列表
     * 参数说明
     * $StartRow  开始行
     * $OrderString 排序字段
     * $Limit 最大行数，不能超过2000
     * 字段说明
     * FNumber  物料编码
     * FName   物料名称
     * FSpecification  规格型号
     * FTaxRateId.FName  默认税率
     * FBARCODE 条码
     * FMaterialGroup  物料分组ID
     *FMaterialGroup.FName 物料分组名称
     * FStoreUnitID.FName 库存单位名称
     * FDefaultVendor.FNumber 默认供应商编号
     * FDefaultVendor.FName 默认供应商
     * FIsVmiBusiness VMI业务
     * FBoxStandardQty 单位箱数量
     * FGROSSWEIGHT 毛重
     * FWEIGHTUNITID.FName 重量单位
     * F_PAEZ_Assistant.FNumber  品牌编号
     * F_PAEZ_Text 产地
     * F_PAEZ_Combo 商品存放
     * F_PAEZ_Combo1 平台保质期单位
     * FDocumentStatus  单据状态
     * FForbidStatus 禁用状态
     */
    public function ListMaterial($StartRow=0,$OrderString,$Limit=20,$Filter=''){
        $FieldKeys='FNumber,FName,FSpecification,FTaxRateId.FName,FBARCODE,FMaterialGroup,FMaterialGroup.FName,FStoreUnitID.FName,FDefaultVendor.FNumber,FDefaultVendor.FName,FIsVmiBusiness,FBoxStandardQty,FGROSSWEIGHT,FWEIGHTUNITID.FName,F_PAEZ_Assistant.FNumber,F_PAEZ_Text,F_PAEZ_Combo,F_PAEZ_Combo1,F_PAEZ_Decimal,FDocumentStatus,FForbidStatus,F_PAEZ_Integer,F_PAEZ_Assistant.FDataValue';
        if(empty($OrderString)){
            $OrderString="FCreateDate desc";
        }
        if(empty($Filter)){
            $Filter="FDocumentStatus='C'";
        }else{
            $Filter.=" AND FDocumentStatus='C'";
        }
        $list=$this->ExecuteBillQuery($FieldKeys,$Filter,$OrderString,0,$StartRow,$Limit);
        if($list){
            return $list;
        }else{
            return false;
        }
    }

    /**
        物料详情
     *   参数说明
     *   $Number  物料编号
     */
    public function DetailsMaterial($Number=''){
        if(empty($Number)){
            return false;
        }
        $FieldKeys='FNumber,FName,FSpecification,FTaxRateId.FName,FBARCODE,FMaterialGroup,FMaterialGroup.FName,FStoreUnitID.FName,FDefaultVendor.FNumber,FDefaultVendor.FName,FIsVmiBusiness,FBoxStandardQty,FGROSSWEIGHT,FWEIGHTUNITID.FName,F_PAEZ_Assistant.FNumber,F_PAEZ_Text,F_PAEZ_Combo,F_PAEZ_Combo1,F_PAEZ_Decimal,FDocumentStatus,FForbidStatus,F_PAEZ_Integer,F_PAEZ_Assistant.FDataValue';
        $FilterString="FNumber='".$Number."'";
        $info=$this->ExecuteBillQuery($FieldKeys,$FilterString);
        if($info){
            return $info;
        }else{
            return false;
        }
    }
}